﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IBatisNet.DataMapper;
using DevExpress.XtraTreeList;
using uIBTv.Model;
using System.Data;
using uIBTv.Domain;
using uIBTv.Extension;
using uIBTv.Service;

namespace uIBTv.Controller
{
    public class UngVienController
    {
        SqlMapper sqlMapper = Service.Mapper.Instance();
        UngVienCollection ungvienCollection;
        UngVienService ungvienService;

        public DataTable GetUngVienId(Guid id)
        {
            try
            {
                var ok = sqlMapper.QueryForList("GetUngvienId", id);
                //ungvienCollection = (Model.UngVienCollection)ok1;
                //ungvienService = new Service.UngVienService(ungvienCollection);
                //DataSet dsUngvien = new DataSet();
                //dsUngvien = ungvienService.DataSetUngVien;
                var lst = new List<Domain.UngVien>();
                foreach (var r in ok)
                {
                    var rx = (Domain.UngVien)r;
                    lst.Add(rx);

                }

                var r1 = from s in lst
                         select new
                         {
                             s.Id_Ungvien,
                             s.Id_Vitri,
                             s.Ho_UngVien,
                             s.Ten_UngVien,
                             s.Diachi,
                             s.So_Dt
                         };
                return r1.ToDataTable();
                //return dsUngvien;
            }
            catch { return null; }
            

            
        }
    }
}
